//
//  DBTests.m
//  FastTest
//
//  Created by Song Lanlan on 13-9-29.
//  Copyright (c) 2013年 tiantian. All rights reserved.
//

#import "DBTests.h"
#import "SQLitePersistentObject.h"
#import "SQLiteInstanceManager.h"

#import "BasicData.h"
#import "Collections.h"

#import "AtMember.h"

@implementation DBTests{
  SQLiteInstanceManager* _manager;

}

-(void)before{
  _manager = [SQLiteInstanceManager sharedManager];
  [_manager.databaseFilepath log];
}

-(void)after{
}

-(void)saveAndLoadWhenObjectContainsNothingWithClass:(Class)class{
	id memory = [[class alloc] init];
	id database;
	
	[memory save];
	[SQLitePersistentObject clearCache];
	database = [class findByPK:[memory pk]];
  
  [database log];
}

-(void)estSave{
  [self saveAndLoadWhenObjectContainsNothingWithClass: [BasicData class]];
}

-(void)estSaveCollections{
  [self saveAndLoadWhenObjectContainsNothingWithClass: [Collections class]];
}

-(void)estRead{
  
}

-(void)testAtMember{
  
  AtMember *at = [AtMember new];
  
  at.memberId = @"jsdfosfhwefojjwef";
  at.nickName = @"安静的耐心";
  at.lastAtTime = [[NSDate date] timeIntervalSince1970];
  [at save];
}

@end
